package com.hex.ds.hdtp.core.inf.common.utils;

import cn.hutool.core.util.StrUtil;

import java.util.regex.Pattern;

/**
 * @Description: string工具类
 * @Package: com.hex.ds.source.common.util
 * @ClassName: StringUtil
 *
 * @Author: xiaoma
 * @Date: 2022/1/18 10:44
 * @Version: v1.0
 **/
public class StringUtil {
    /**
     * @Description: 字符串比较忽略大小写和字符
     * @Method: stringEqualsIgnoreCaseAndSymbol
     * @Param: originalString 1 原字符串
     * @Param: targetString 2 目标字符串
     * @Return: boolean
     *
     * @Author: xiaoma
     * @Date: 2022/1/18 10:57
     * @Version: V1.0
     */
    public static boolean stringEqualsIgnoreCaseAndSymbol(String originalString, String targetString) {
        Pattern pattern = Pattern.compile("[\\p{Punct}]");
        String targetReplaceSymbol = "";
        return StrUtil.equalsIgnoreCase(
                pattern.matcher(originalString).replaceAll(targetReplaceSymbol),
                pattern.matcher(targetString).replaceAll(targetReplaceSymbol)
        );
    }
}
